import rospy
from sensor_msgs.msg import NavSatFix

def gps_callback(msg):
    rospy.loginfo("Latitude: %f, Longitude: %f, Altitude: %f", msg.latitude, msg.longitude, msg.altitude)

def main():
    rospy.init_node('gps_listener', anonymous=True)
    rospy.Subscriber('/mavros/global_position/global', NavSatFix, gps_callback)
    rospy.spin()

if __name__ == '__main__':
    main()
